<?php

class XmlController extends Controller
{

  public $masterPage = 'Default';

  public function IndexAction()
  {
    return $this->View('index')
                    ->Render();
  }

  public function XsltAction()
  {


    return $this->View('xslt')
                    ->Render();
  }

  public function WebServiceAction()
  {
    $model = new Calculator();
    
    // post back
    if(System::Web()->HttpRequest->HttpMethod == "POST"){
      
      $model = My::System()->HttpRequest->Form()->ToObject(Calculator);
      $model->Process();
      
      if(!$model->HasResult)
        System::Diagnostics()->Log->dump($model->soapException);
        
    } else {

      $model->expression = '2+2';
      $model->Process();
    }
    
    return $this->View('webservice')
                ->Model($model)
                ->Render();
  }

}
